<?php $this->start('aside'); ?>
<?php echo $this->element('aside'); ?>
<?php $this->end(); ?>

<?php $this->start('top'); ?>
<?php echo $this->element('top'); ?>
<?php $this->end(); ?>

<?php $this->start('PluginStyle'); ?>
<?php echo $this->Html->css(['/assets/bootstrap-validator-0.5.2/css/bootstrapValidator.min']); ?>
<?php $this->end(); ?>

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				编辑产品
			</div>
			<div class="panel-body">
				<div class="row">
					<div class="col-lg-12">
						<?php echo $this->Form->create('Product', ['class' => 'form-horizontal']); ?>
						<?php echo $this->element('tip'); ?>
						<div class="form-group">
							<?php echo $this->Form->label('Product.name', '产品名称：', ['class' => 'col-lg-3
							control-label']); ?>
							<?php echo $this->Form->input('name', ['label' => false, 'div' => 'col-lg-5', 'class' =>
							'form-control']);
							?>
						</div>
						<div class="form-group">
							<?php echo $this->Form->label('Product.description', '产品描述：', ['class' => 'col-lg-3
							control-label']); ?>
							<?php echo $this->Form->input('description', ['label' => false, 'div' => 'col-lg-5', 'class'
							=> 'form-control']); ?>
						</div>
						<div class="form-group">
							<?php echo $this->Form->label('Product.detail', '产品详情：', ['class' => 'col-lg-3
							control-label']); ?>
							<?php echo $this->Form->input('detail', ['label' => false, 'rows' => 10, 'cols' => 60, 'div'
							=> 'col-lg-5', 'class' => 'form-control']); ?>
						</div>
						<div class="form-group">
							<?php echo $this->Form->end(['label' => '保 存', 'class' => 'btn btn-success', 'div' =>
							'col-lg-offset-4 col-lg-8']); ?>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<?php $this->start('PluginScript'); ?>
<?php echo $this->Html->script([
'/assets/bootstrap-validator-0.5.2/js/bootstrapValidator.min',
'form-validation'
]);
?>
<?php $this->end(); ?>

<?php $this->start('PageScript'); ?>
<script>
	(function ($) {
		var $form = $('#ProductEditForm');
		$form.bootstrapValidator({
			message: '这个值填写无效，请检查',
			feedbackIcons: {
				valid: 'glyphicon glyphicon-ok',
				invalid: 'glyphicon glyphicon-remove',
				validating: 'glyphicon glyphicon-refresh'
			},
			fields: {
				'data[Product][name]': {
					validators: {
						notEmpty: {
							message: '请填写产品名称'
						}
					}
				}
			}
		}).on('success.form.bv', function (e) {
			var fv = FormValidation();
			fv.init(e);
		});
	})(jQuery);
</script>
<?php $this->end(); ?>
